package com.seehope.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.mchange.v2.c3p0.ComboPooledDataSource;

public class DBUtil {

	 private static ComboPooledDataSource data =new ComboPooledDataSource();

	 public static Connection getDate() throws SQLException{
		   return data.getConnection();
	 }

     public static void close(Connection con,PreparedStatement pst, ResultSet rs){
    	
    	  try {
    		    if(rs!=null){
				  rs.close();
    		    }
    		    if(pst!=null){
    		    	pst.close();
    		    }
    		    if(con!=null){
    		    	con.close();
    		    }
		  } catch (SQLException e) {
			   // TODO Auto-generated catch block
			   e.printStackTrace();
		  }
    	 
     }
}
